package com.juku2024.juku.network.api

import com.juku2024.juku.analysis.model.AnalysisVideoModel
import com.juku2024.juku.analysis.model.JHYModel
import com.juku2024.juku.analysis.model.JHYRequest
import com.juku2024.juku.analysis.model.PVUrlModel
import com.juku2024.juku.analysis.model.ParseTXModel
import com.juku2024.juku.analysis.model.YouKuModel
import com.juku2024.juku.analysis.model.YoukuKeyModel
import io.reactivex.Observable
import retrofit2.http.*

interface AnalysisApi {

    @GET
    fun parse(@Url url: String): Observable<AnalysisVideoModel>

    @GET
    fun parseString(@Url url: String): Observable<String>

    @GET
    fun parseString(@HeaderMap headers: Map<String, String>, @Url url: String): Observable<String>

    @FormUrlEncoded
    @POST
    fun parsePost(@HeaderMap headers: Map<String, String>, @Url url: String, @Field("data") param: String): Observable<String>


    @GET
    @Headers("user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Mobile Safari/537.36")
    fun parsePV(@Url url: String): Observable<PVUrlModel>

    @POST("/api/video/parsing/{id}.do")
    fun parseJHY(
        @Path("id")id: Long,
        @Body request: JHYRequest,
    ): Observable<JHYModel>

    @GET
    @Headers("Referer: http://video.tudou.com/", "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" )
    fun parseQQ(@Url url: String): Observable<ParseTXModel>


    @GET("http://42.157.129.24:3456/ykapi.php")
    fun getYoukuKey(): Observable<YoukuKeyModel>

    @GET("https://ups.youku.com/ups/get.json")
    @Headers("Referer: http://video.tudou.com/", "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" )
    fun getYoukuContent(
        @Query("vid") vid: String,
        @Query("ccode") ccode: String,
        @Query("client_ip") client_ip: String,
        @Query("client_ts") client_ts: String,
        @Query("utid") utid: String,
        @Query("ckey") ckey: String,
    ): Observable<YouKuModel>


}